package com.zhang.controller;

import com.zhang.pojo.ReplyBean;
import com.zhang.pojo.UserBean;
import com.zhang.service.IReplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("reply")
public class ReplyController {
    @Autowired
    private IReplyService replyService;

    @RequestMapping("add")
    public String add(HttpServletRequest req,ReplyBean replyBean,int mainId){
        UserBean userBean = (UserBean) req.getSession().getAttribute("userBean");
        int userId = userBean.getUserId();
        replyService.addReply(replyBean,mainId,userId);
        return "ok";
    }
}
